package server.network;

import shared.network.messages.TextMessage;

import com.jme3.network.HostedConnection;
import com.jme3.network.Server;

public class ConnectionListener implements com.jme3.network.ConnectionListener {

	@Override
	public void connectionAdded(Server server, HostedConnection hostedCon) {
		TextMessage t = new TextMessage("Client connected", hostedCon.getAddress() + " connected with the ID " + hostedCon.getId());
		System.out.println(t.toString());
		server.broadcast(t);
	}

	@Override
	public void connectionRemoved(Server server, HostedConnection hostedCon) {
		TextMessage t = new TextMessage("Client disconnected", hostedCon.getAddress() + " disconnected with the ID " + hostedCon.getId());
		System.out.println(t.toString());
		server.broadcast(t);
	}

}
